package kuoge.practice.kafka.stream.member;

import org.apache.kafka.common.serialization.Serdes;
import org.apache.kafka.streams.StreamsConfig;

import java.util.Properties;

/**
 * @Description
 */
public class KafkaConfigFactory {
    private static final Properties producer_props = new Properties();
    private static final Properties consumer_props = new Properties();
    static {
        producer_props.put(StreamsConfig.APPLICATION_ID_CONFIG, "streams-member-rfm");
        producer_props.put(StreamsConfig.BOOTSTRAP_SERVERS_CONFIG, "localhost:9092");
        producer_props.put(StreamsConfig.DEFAULT_KEY_SERDE_CLASS_CONFIG, Serdes.String().getClass());
        producer_props.put(StreamsConfig.DEFAULT_VALUE_SERDE_CLASS_CONFIG, Serdes.String().getClass());

        consumer_props.put("bootstrap.servers", "localhost:9092");
        consumer_props.put("linger.ms", 1);
        consumer_props.put("key.deserializer", "org.apache.kafka.common.serialization.StringDeserializer");
        consumer_props.put("value.deserializer", "org.apache.kafka.common.serialization.LongDeserializer");
        consumer_props.setProperty("group.id", "topic_test");
    }

    public static Properties getProducerProperties() {
        return producer_props;
    }

    public static Properties getConsumerProperties() {
        return consumer_props;
    }

    public static Properties getStreamProperties() {
        return producer_props;
    }
}
